"""分离自动化测试用例表

Revision ID: 8adaadbb2957
Revises: d6c188e330ad
Create Date: 2025-05-30 17:29:50.129759

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '8adaadbb2957'
down_revision = 'd6c188e330ad'
branch_labels = None
depends_on = None


def upgrade():
    # ### 重命名表，保持数据完整性 ###
    
    # 1. 重命名主要的测试用例相关表
    op.rename_table('test_cases', 'auto_test_cases')
    op.rename_table('test_case_steps', 'auto_test_case_steps')
    op.rename_table('test_case_pre_steps', 'auto_test_case_pre_steps')
    op.rename_table('test_suite_cases', 'auto_test_suite_cases')
    
    # 2. 为功能测试系统创建新的test_cases表（如果需要的话，这将在功能测试系统的迁移中处理）


def downgrade():
    # ### 恢复原来的表名 ###
    op.rename_table('auto_test_cases', 'test_cases')
    op.rename_table('auto_test_case_steps', 'test_case_steps')
    op.rename_table('auto_test_case_pre_steps', 'test_case_pre_steps')
    op.rename_table('auto_test_suite_cases', 'test_suite_cases')
